//
//  LzwKichenTableCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/2.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwKichenTableCell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"

@interface LzwKichenTableCell ()

@property (nonatomic, retain) LzwBaseImageView *myImageKichen;
@property (nonatomic, retain) LzwBaseImageView *myImageKichen1;

@property (nonatomic, retain) LzwBaseLable *myLableKic;
@property (nonatomic, retain) LzwBaseLable *myLableKic1;



@end



@implementation LzwKichenTableCell

-(void)dealloc{
    [_myImageKichen release];
    [_myImageKichen1 release];
    [_myLableKic release];
    [_myLableKic1 release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatKichen];
    }
    return self;
}

-(void)creatKichen{
    
    //图片
    self.myImageKichen = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(3 * WIDTH, 3 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myImageKichen.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myImageKichen];
    
    //喜爱图片
    self.myImageKichen1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myImageKichen1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myImageKichen1];
    
    //描述
    self.myLableKic = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLableKic.textColor = [UIColor lightGrayColor];
    self.myLableKic.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableKic.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableKic];
    
    //喜爱人数
    self.myLableKic1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLableKic1.textColor = [UIColor lightGrayColor];
    self.myLableKic1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableKic1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableKic1];
    
    [_myImageKichen release];
    [_myImageKichen1 release];
    [_myLableKic release];
    [_myLableKic1 release];
    

    
}

-(void)setModleKic:(LzwKichenModle *)modleKic{
    
    if (_modleKic != modleKic) {
        [_modleKic release];
        _modleKic = [modleKic retain];
        
    }
    
    self.myLableKic.text = self.modleKic.title;
    self.myLableKic1.text = self.modleKic.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleKic.pic];
    
    [self.myImageKichen sd_setImageWithURL:url placeholderImage:nil];
}

@end
